Skip to content

feat(chatbot): draw verified record citations as chips that open the cited section - #37485

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-37365-record-citation-chips
Nov 26, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-37365-record-citation-chips

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #37365
Clause-②: yes (a new reserved URL parameter section)
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:使用应用内 AI 的用户,在回答下方看到“引自记录”的引用条(每条显示摘句);点一条就打开那条记录,并滚到被引的那一节、高亮标出。
  • 为什么做:记录 AI 问询专题的第 10b 行,让用户能从 AI 回答一键跳回原文核对。
  • 出错会怎样:引用条不显示或跳到记录顶部,记录本身与数据不受影响;撤回本次合并即可恢复原样。
  • 要你做什么:无。

What changes

Governing text: ADR-0160 D9 as amended by #37363; ruling 7177410380 on #37144 (Q1 A: draw the persisted, already-verified list, never re-verify; Q3 A: a related-row quote opens the root record).

  • Lift (plugin-chatbot/src/mapMessages.ts): extractRecordCitations(parts) reads the last data-record-citations part (RECORD_CITATIONS_PART_TYPE) through the spec's RecordCitationsSchema. A part the schema refuses, or an empty list, is no list (the detectAnswerSource precedent). uiMessageToChatMessage carries it as recordCitations; chatMessageAdapter.ts names the new render-only key.
  • Chips (plugin-chatbot/src/RecordCitations.tsx, new; drawn in ChatbotEnhanced.tsx beside AnswerSourceBlock): one chip per citation showing the quote. A click calls onOpenRecord({ objectName: object, recordId: id, anchor }); onOpenRecord's argument gains an optional anchor. Nothing is fetched or verified on display.
  • Open (app-shell/src/console/ai/AiChatPage.tsx): openRecord takes the optional anchor and navigates to recordOpenTarget(app, …) = /apps/APP/OBJ/record/ID?section=ANCHOR. The dock and the /ai page both draw this ChatPane.
  • Param (app-shell/src/urlParams.ts): RECORD_SECTION_PARAM = 'section', in RESERVED_URL_PARAMS and the param table. RECORD_SECTION_OPENED_STATE is a history-state key, not a URL parameter (the RECORD_COMMENTS_PUSHED_STATE precedent).
  • Record page (app-shell/src/views/recordSectionAnchor.ts, new; wired in RecordDetailView.tsx): once the record is held, the spec's headingsOf runs on each long-text field (markdown, html/richtext, textarea) in field order; the first whose outline issues the anchor is the body. The heading element is found in that field's drawn face and scrolled to and marked (the linked-comment marking). The match is trusted only when the face draws exactly as many headings of that title as the outline lists. A textarea body, a heading that is not drawn within 4 s, a count that differs, or a heading with no letter or digit scrolls to the field. A stale anchor opens the top. The cleanup takes the mark off, so opening another section moves the mark. Each chip click carries a fresh history-state value (RECORD_SECTION_OPENED_STATE), so the same chip clicked again opens its section again; a navigation that keeps the state, such as a tab switch, does not.
  • Field marker (plugin-detail/src/DetailSection.tsx): each detail row carries data-detail-field={field.name}, which is how the page finds a field. One attribute, no behaviour change.
  • i18n: chatbot.recordCitations.title in all 11 ui/packages/i18n locales.
  • Docs: content/docs/frontend/plugins/plugin-chatbot.mdx, ui/packages/plugin-chatbot/README.md; changeset .changeset/37365-record-citation-chips.md (patch, four @object-ui/* packages).

Read first, by risk:

  1. ui/packages/app-shell/src/views/recordSectionAnchor.ts: locateSection (how a drawn heading is matched) and focusRecordSection (observer and settle timer).
  2. ui/packages/plugin-chatbot/src/mapMessages.ts: extractRecordCitations (the parse gate).
  3. ui/packages/app-shell/src/views/RecordDetailView.tsx: the effect beside holdsRouteRecord.

Tests

Head c1b30e6a0b. Every run went through scripts/pm/os-verify-lock.sh on a shared box.

  • New pins: plugin-chatbot/src/__tests__/ChatbotEnhanced.recordCitations-37365.test.tsx (lift through the spec schema; chips; a refused part draws nothing with a CONTROL leg; no fetch on display; related-row quote opens the root record; record-link grammar still refuses a fragment, with a CONTROL); app-shell/src/views/recordSectionAnchor.test.tsx (anchor derived as the server derives it; matching by reading with repeats; a same-titled heading the outline does not list, a listed heading the face does not draw, and a heading with no letter or digit each open the field, each with a CONTROL; textarea opens at the field; a heading never drawn settles on the field; stale anchor moves nothing, with a CONTROL; the cleanup unmarks, keeping a class the heading already had; the same section opened again scrolls and marks again); app-shell/src/views/RecordDetailView.citedSection-37365.test.tsx (the REAL RecordDetailView and the real markdown face: ?section=scope marks and scrolls the first Scope, scope-2 the second, a textarea body scrolls to the field, a stale anchor opens the top with a CONTROL, a setext Scope above the cited # Scope opens the field with a CONTROL, a second chip moves the mark and the same chip again scrolls again, CONTROL a state-keeping replace does not); a new describe in AiChatPage.recordLink-13037.test.tsx (the real ChatPane: the chip opens /apps/APP/OBJ/record/ID?section=scope under a /_console and a root mount; each click carries a fresh opened-state value; a related-row quote opens the root record with no section).
Whole suites of the four touched packages, at c1b30e6
  • @object-ui/plugin-chatbot: Test Files 104 passed (104) · Tests 1089 passed (1089)
  • @object-ui/i18n: Test Files 111 passed (111) · Tests 2028 passed | 13 skipped (2041)
  • @object-ui/plugin-detail: Test Files 419 passed | 1 skipped (420) · Tests 3968 passed | 18 skipped (3986)
  • @object-ui/app-shell: Test Files 2437 passed | 1 skipped (2438) · Tests 23428 passed | 9 skipped (23437)
  • All four ran in one lock hold: VERDICT command-exit 0, each package exit 0.
  • type-check: app-shell exit 0 at c1b30e6a0b. plugin-chatbot, plugin-detail and i18n exit 0 at 60981028c; this round changes no source of theirs.
  • Derived gate families: 73 derived, 73 run, every one recorded exit 0 (dispatch-gates --ran: "a DERIVED zero"), check:type-check-debt included.
Ablation of the parse gate (round 1, at 6098102)

node scripts/ablation-replace.mjs replaced the RecordCitationsSchema.safeParse lines in extractRecordCitations with a bare Array.isArray pass-through (anchor x1 to x0, blob 0354c5b73c28 to 400078723215). The chip test then went red: Tests 5 failed | 9 passed (14); the failing tests were the four refused-part cases and "a part that fails the parse draws nothing". Restored: blob equals HEAD (0354c5b73c28) and git diff HEAD is empty. plugin-chatbot resolves to src through the vitest alias, so no dist rebuild was involved. This round does not touch that file.

Mutation of the count check (round 2, at c1b30e6)

node scripts/ablation-replace.mjs replaced drawn.length === candidate.count ? drawn[candidate.ordinal] : undefined in locateSection with drawn[candidate.ordinal] (anchor x1 to x0, blob 20eec4db25ed to f4f48f4f6379). The two section test files then went red: Tests 3 failed | 21 passed (24). The failures were the same-titled unlisted heading and the listed-not-drawn heading pins in recordSectionAnchor.test.tsx, and the setext pin in RecordDetailView.citedSection-37365.test.tsx. Restored with git checkout HEAD --: blob equals HEAD (20eec4db25ed) and git diff HEAD is empty. app-shell tests import their own src, so no dist was involved.

Acceptance notes

  • Which field is the body. The URL carries only section, so the page cannot read the citation's context pack. It runs headingsOf on every long-text field the record holds (markdown, html, richtext, textarea), in field order, and the first whose outline issues the anchor is the body. When the pack's body field holds the anchor, the result is the same. Another long-text field earlier in the field order that has a heading with the same anchor would be opened instead. The alternative, reading the pack's body.field, would need context on the URL as well; it was not taken.
  • A2 (measured: holds only in part). The drawn face shows headings that headingsOf does not list: setext headings, an empty #, headings inside a quote or a list, an indented ATX heading, and empty h1-h6 in html. The outline also lists headings the face does not draw, such as a # line inside a raw HTML block or a four-backtick fence. With a bare Nth-element rule, each of these shifts every later heading. The rule taken (locateSection) has two parts. First, among the field's drawn heading elements, it picks those whose letters and digits read the same as the outline's heading and indexes them by the outline's repeat count. Second, it trusts that index only when the face draws exactly as many headings of that reading as the outline lists. Otherwise it opens the field, and it also opens the field for a heading with no letter or digit. So a differing heading of another title shifts nothing. A same-titled one, or a listed one the face does not draw, opens the field rather than a heading that may be another. A heading whose raw text carries letters the face does not draw (a link's URL) reads differently and opens at the field too. Two headings that normalise alike (C and C++) are told apart by order, which both sides share.
  • Moving the mark (round 2). The focus cleanup takes the attribute and only the classes the mark added. A second citation on the open record, or the record left, leaves no stale mark. The chat opener puts a fresh RECORD_SECTION_OPENED_STATE value on each chip click, and the record page keys the focus on record, anchor and that value. So the same chip clicked again (same URL) scrolls and marks again. The tab and comment writers replace the URL keeping location.state, so they do not re-scroll.
  • Files beyond the claim's surface. (1) ui/packages/plugin-detail/src/DetailSection.tsx gets one data-detail-field attribute on each detail row. Without it the page has no way to find a field, so the textarea and not-drawn cases could not open at the field. (2) ui/packages/plugin-chatbot/src/chatMessageAdapter.ts gets one key on RuntimeOnlyMessageKeys, the declared place for a new render-only message key. (3) The new helper ui/packages/app-shell/src/views/recordSectionAnchor.ts. (4) The chatbot docs page and README. overlap-check is clean against origin/main and against feat(spec,ui): a field can be read-only by hand at the console while writes keep it (uiReadonly / uiReadonlyWhen) #37436, which shares DetailSection.tsx and the 11 locale files (disjoint hunks), and feat(spec)!: form is a metadata type of its own, and the form doors read a form over both types #37422, which shares the 11 locale files.
  • Not covered: a reload. The chips are drawn from the live stream. When the /ai page rebuilds history, it drops any data-* part other than charts: hydratedMessagesToChatMessages, then useObjectChat's initialMessages rebuild, then the browser display cache (sanitizeChatMessagesForCache). So a persisted citation list does not come back after a reload yet; 37365 跟进:刷新或重开对话后,AI 回答下方的引用消失 #37487 carries it. Nothing on main emits the part before cloud 10c. The changeset and both doc pages say so: the console draws a verified citations part when a live answer carries one.
  • Clause-②: yes because a new console URL parameter is reserved. onOpenRecord's argument gains an optional member (widening). No spec file changed.

Verification

  • Browser: NOT MEASURED here. The seat carries it on 37365 跟进:刷新或重开对话后,AI 回答下方的引用消失 #37487's acceptance: scroll under the sticky chrome, ring visibility, the lazy face against the 4 s settle, the phone row, and html/richtext bodies. In its place, RecordDetailView.citedSection-37365.test.tsx renders the real record page with the real markdown face.
  • Two-minute check: in the console, ask the assistant something an answer with a data-record-citations part covers (cloud 10c). Click a chip. Expected: the address is /apps/APP/OBJ/record/ID?section=ANCHOR, the cited heading is scrolled into view with the accent ring, and an edited-away heading opens the record at its top.

Generated by Claude Code

@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 26, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 6098102 · 2026-11-26T08:33Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 60981028c1462e71f9b72f08ef312e4c0c0d98d8
Local-runs: none

PR #37485 (card #37365, epic #36996 row 10b). Declaration face: the paths decide no face, the changeset's Clause-②: yes does. Read: the card body and its five comments (triage 7177776258, unblock 7182901366, claim 7182933721, os-dev report 7186618419, claim amendment 7186643284), the PR body, git diff origin/main...pr-37485 (27 files, +1050/−14, merge base 5d21d431e), the head's check-runs, card #37487, ADR-0160 D3/D9 and record-body-anchor.ts / record-citation.zod.ts on main (4925039a75). Nothing was built or run; every finding below is a reading of the code, and none was reproduced.

① Derived judgments

Verdict in one line: no must-fix. Four should-fix, five nits. The security questions come out clean; the "never a wrong heading" claim does not hold as written (S1).

1. Security and leaks: clean.

  • Where a chip can navigate. recordOpenTarget (AiChatPage.tsx) builds a fixed /apps/APP/OBJ/record/ID path, each segment through encodeURIComponent, and the anchor through URLSearchParams. The string always starts with /apps/ and goes to the router's navigate, so no scheme (javascript:, data:), no host and no protocol-relative form can be produced: no open redirect. The anchor cannot leave the query string. One residue is N1 below (dot segments).
  • The anchor and the DOM. The section value is only compared with === against the anchors headingsOf derives (sectionCandidates). It is never put in a selector, an attribute, an id or markup. The one selector built (locateSection) interpolates a field NAME taken from the object's metadata, not from the URL, with " and \ escaped. The mark is a fixed attribute and fixed classes. The chip draws quote as React text and a title attribute. No injection path found.
  • Reading rights. The chip only navigates; the record route does its ordinary read. sectionCandidates runs only once holdsRouteRecord is true, on readablePageRecord, so it sees only what the page already holds for this user; a field the user is not served is absent and yields no candidate. Nothing is fetched or verified on display (ruling Q1), and no endpoint is added.
  • The part is read through RecordCitationsSchema.safeParse (strict object, max 20); a refused part or an empty list draws nothing. The ablation in the PR body covers that gate.
  • Security-touching: no: no changed hunk changes or teaches permission, sharing, credential, token or authentication behaviour.

2. section as a reserved param: holds. RECORD_SECTION_PARAM = 'section' is declared in ui/packages/app-shell/src/urlParams.ts, the one registry, in the param table and in RESERVED_URL_PARAMS, and pinned in recordSectionAnchor.test.tsx. On main no reader or writer uses section as a query parameter in ui/ or packages/ (the hits are component types, HTML tags and JSX props). The reader imports the constant; no literal. The writer is the chat opener alone.

3. Point (a), the heading locator.

S1 (should-fix) — locateSection can mark a wrong heading, so "falls back to the field, never to a wrong heading" is false as written. ordinal counts earlier headings of the OUTLINE that read the same; the index is then applied to the DRAWN headings that read the same. The two sets differ exactly where A2 failed, and when the differing heading reads the same as the cited one, the index lands on it:

  • Drawn but not listed, before the cited one. Body: a setext Scope heading, then # Scope. The outline lists one heading, anchor scope, ordinal 0. The face draws two that read scope; index 0 is the setext one. The same holds for > # Scope in a quote, a heading in a list item, and an ATX heading indented one to three spaces (CommonMark draws it; markdownHeadingOf counts # from column 0 and does not list it).
  • Listed but not drawn. A # Scope line inside a block the face does not draw as a heading (a raw HTML block; a four-backtick fence whose inner three-backtick line isFence reads as a close) takes anchor scope, and the real later heading takes scope-2. Citing scope marks the real heading; citing scope-2 falls to the field.
  • A heading with no letter or digit (anchor section-N) has the reading "", which also matches every empty heading the face draws.
    Two different headings that merely normalise alike (C and C++, Re-scope and Rescope) do resolve correctly, since the same reading orders both sides; the fault needs the sets to differ. It is rare, and the heading reached carries the same title. Smallest fix: carry the outline's same-reading count on the candidate and open at the field when the drawn same-reading count differs; add the setext-duplicate case as a pin. Until then the PR body and the report should not say "never".

S2 (should-fix) — a second citation of the same record leaves the first mark on. focusRecordSection's cleanup disconnects and clears the timer but never removes data-record-section-target or the mark classes. With the dock beside the record, clicking chip A (scope) and then chip B (scope-2) changes citedSectionKey on a mounted RecordDetailView whose body is not redrawn, so both headings stay marked. Several citations of one record is the ordinary case. The cleanup should unmark. A related gap: clicking the same chip again after scrolling away does nothing, because the key is unchanged.

Accepted as disclosed: the body is the first long-text field in field order whose outline issues the anchor, not the pack's body.field (the URL carries no context). ADR-0160 D9 leaves "how a surface opens the root record at anchor" to row 10, so this is the PR's to decide.

4. Point (b), surface beyond the claim: acceptable. The report lists the extra files under deviations, the PR body under acceptance notes, and claim amendment 7186643284 records them on the card. The dispatch shape is "stop on breach; explain in the report"; the dev explained and did not stop, and the amendment came after the push (N5). Each addition is the smallest that works: one attribute on the two detail row faces, one key on RuntimeOnlyMessageKeys, the helper and its test, two doc pages. data-detail-field collides with no existing attribute (data-detail-field-row and -label are distinct names). Overlap with #37436 (open, head 116e0426e9): its DetailSection.tsx hunks are at lines 35 and 648, this PR's at 952 and 979; it also edits all 11 locale files, near line 200, against this PR's near line 4700 and later. Disjoint hunks in every shared file, either merge order.

5. Points (c) and (d).

  • (d) verified with git. git diff e581d1410..60981028c touches five files: the changeset, plugin-chatbot.mdx, the chatbot README.md, recordSectionAnchor.ts (three lines: the let timer became a const pending holder) and RecordCitations.tsx (one line: export dropped from recordCitationTarget). The claim is exact. It is also moot: the head's own CI ran the full suites (Test UI 16/16 shards, Type Check UI, Lint UI, Build & E2E UI, all success).
  • Check-runs on the head: 62 completed, 52 success, 10 skipped, 0 failed, as the area reports.

S4 (should-fix) — the browser reading is NOT MEASURED and has no carrier. The substitute (the real RecordDetailView with the real markdown face in jsdom, scrollIntoView stubbed) proves which element is chosen. It does not measure: where block: 'start' lands under the page's sticky chrome, whether the ring is visible, the lazy face against the 4 s settle, the phone row face, or an html/richtext body in the real view (that face is pinned only against hand-written DOM). No producer exists before cloud 10c, so no user reaches this path yet and it need not block; but the check should be written onto a card (#37487 or the 10c card) so it is done before 10c ships.

6. Point (e): #37487 is the right carrier. Open, priority:p2, pm:queue, area:ai, Parent: #37365; it names the three rebuild paths, asks a pin and a control per path, and says to land before 10c. See S3 for what the PR's own text should say meanwhile.

S3 (should-fix) — the docs and the changeset claim more than the head delivers. Both say an answer "now draws" its citations and that "the list is drawn as it was persisted". On this head no producer emits data-record-citations (the only hits on main are the spec's own declaration), and a persisted list is not redrawn after a reload (#37487). AGENTS.md rule 10 asks the claim to be as narrow as the enforcement, and the changeset sentence ships in CHANGELOG.md. Add one sentence to the changeset and the two doc pages: drawn for a live turn whose stream carries the part; not yet restored from history (#37487).

7. Locales: clean. chatbot.recordCitations.title is present once in each of the 11 locale files (ar, de, en, es, fr, ja, ko, pt-BR, ru, zh-Hans, zh-Hant), at the same place in the chatbot block. All ten non-English values are translated; es and pt-BR share the spelling Citado de registros, which is correct in both. It is the only user-facing string the diff adds.

Nits.

  • N1 (nit) — encodeURIComponent leaves . and .. whole, so a citation whose object or id is .. yields a path with a dot segment. It stays same-origin under the console's routes and the page still authenticates; open_record on main has the same shape; and the list is verified server-side before it is persisted. recordOpenTarget could refuse the two values.
  • N2 (nit) — escapeAttr escapes " and \ only; CSS.escape is the complete form. Field names are metadata identifiers, so nothing reaches it today.
  • N3 (nit) — sectionCandidates runs headingsOf over every long-text field on every render of RecordDetailView while ?section is present. A useMemo on the record, the fields and the anchor would do.
  • N4 (nit) — the card's 维护者速读 says a citation lists 记录名 + 摘句; the chip shows the quote alone, as the card's What ✨ Set up Copilot instructions #2 says. Two citations of different records are told apart only by their quotes. No name is available without a fetch, which ruling Q1 excludes.
  • N5 (nit) — the PR body names DetailSection.tsx as the one file shared with feat(spec,ui): a field can be read-only by hand at the console while writes keep it (uiReadonly / uiReadonlyWhen) #37436; the 11 locale files are shared too (disjoint). The claim amendment was posted after the push, not before.

② Semver level

patch on @object-ui/plugin-chatbot, @object-ui/app-shell, @object-ui/plugin-detail and @object-ui/i18n: correct. Metadata-protocol: none takes patch, and a non-protocol widening ships patch (AGENTS.md, Post-Task Checklist step 3). The four packages are exactly those whose src the diff moves. Both declaration lines stand at line start in the PR body and the changeset body and agree. Clause-②: yes is right: section is a new reserved console URL parameter and onOpenRecord's argument gains an optional anchor; both are widenings, nothing is narrowed, and the record-link grammar is untouched (recordLink.ts is not in the diff). No spec file changed. Check Changeset and the PR-body guards are green on the head.

③ Boundary flags

  • open_questions: empty. Nothing to answer.
  • security_findings: none: agreed, with N1 and N2 as hardening notes.
  • Deviation, files beyond the claim: answered in ① 4. Accepted.
  • Deviation, browser NOT MEASURED: answered in ① 5 (S4). Accepted for this head, carrier owed.
  • Deviation, full suites at e581d1410: answered in ① 5. Verified and moot.
  • Deviation, PR footer form: no contract effect.
  • Reading A2 "holds only in part": the fix taken is narrower than claimed (S1).
  • Out-of-scope finding, chips lost on reload: carried by 37365 跟进:刷新或重开对话后,AI 回答下方的引用消失 #37487. Accepted (S3 for the wording).
  • SQL push-down: not touched. The diff adds no data read, no id materialisation and no in-app join; the locator reads only the record the page already holds.

Implemented-by: claude/issue-37365-record-citation-chips
Reviewed-by: session_01Utp6CYtTDvfPQDzMbZnN5X

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

席位核对

Head-sha: 60981028c1462e71f9b72f08ef312e4c0c0d98d8
REWORK — L1, seat repo:objectstack#5. Contract record 7186860933 (declaration face, TIER_DEFAULT) reads PASS, with four should-fix findings and no must-fix.

Security came out clean:

  • The route is always /apps/…/record/…, with each segment encoded and the anchor in URLSearchParams.
  • section is only compared with ===, never put into a selector.
  • The record route runs its normal read.
  • section is declared in RESERVED_URL_PARAMS.

S1–S3 close in this PR before ACCEPT. S4 needs a named carrier.

  1. Shape: open draft against main, 27 files (+1050/−14), Clause-②: yes (new reserved URL param section), Metadata-protocol: none, patch on four packages. Not governed. Check-runs: 52 success, 10 skipped, 0 failed.
  2. Premise: extractRecordCitations reads through the spec schema, and a refused part draws nothing. The overlaps with feat(spec,ui): a field can be read-only by hand at the console while writes keep it (uiReadonly / uiReadonlyWhen) #37436 (DetailSection.tsx, the 11 locales) are disjoint hunks and safe in either order. 37365 跟进:刷新或重开对话后,AI 回答下方的引用消失 #37487 is the right carrier for the lost-on-reload case.
  3. Owed before ACCEPT:
    • S1. locateSection can mark the wrong heading. The ordinal counts same-reading headings in the outline but indexes into the drawn face. Example: a setext, quoted, list or indented Scope before # Scope takes index 0. The reverse also happens: an outline-listed heading the face does not draw shifts the real one. Fix: carry the outline's same-reading count, and fall back to the field when the drawn count differs. Pin the setext-duplicate case. The "never a wrong heading" claim must then hold as written.
    • S2. focusRecordSection's cleanup never removes the mark. A second chip for the same record with a different anchor leaves both headings marked. The same chip, clicked again after scrolling away, does nothing. Unmark on change and re-run on a repeat click, then pin both.
    • S3. The changeset and both doc pages say an answer "now draws" its citations "as persisted". Nothing on main emits the part (that is cloud 10c), and a reload does not redraw it (37365 跟进:刷新或重开对话后,AI 回答下方的引用消失 #37487). Narrow the wording. The changeset sentence ships in CHANGELOG.md.
    • S4. The browser check (scroll under sticky chrome, ring visibility, the lazy face against the 4 s settle, the phone row, html/richtext bodies) is NOT MEASURED and has no carrier. Add it to 37365 跟进:刷新或重开对话后,AI 回答下方的引用消失 #37487's acceptance, or to the 10c card, by name. No user reaches this path before 10c.
    • The same reviewer reads the delta.
  4. Accepted deviations (nits, record only):
  5. Out of scope and where it went: chips lost on reload go to 37365 跟进:刷新或重开对话后,AI 回答下方的引用消失 #37487 (p2, under 记录 AI 问询 10b:控制台显示核对过的引用,点开记录并定位到被引章节 #37365, lands before 10c). The browser check goes there or to 10c (S4).
  6. Landing terms: ungoverned, default tier. Still owed: S1–S3 closed, S4 carried, a same-head delta PASS, and an ACCEPT. Then the area lands it.

…s, and move the mark

The record page's section locator now carries the outline's count of
same-titled headings and opens the field, not a heading, when the drawn face
draws a different number of them (a setext, quoted or listed duplicate, or an
outline heading the face does not draw), and when the heading has no letter
or digit. The focus cleanup takes the mark off, so a second citation leaves
only its own section marked; each chip click carries a fresh history-state
value, so the same chip opens its section again. The changeset and the two
doc pages now say the console draws a verified citations part when an answer
carries one, not yet after a reload.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract review

Served-tier: TIER_DEFAULT
Head-sha: c1b30e6a0b0c2548b331de1711581d9749459203
Local-runs: none
Security-touching: no

Delta round on PR #37485 (card #37365, epic #36996 row 10b), declaration face. It follows record 7186860933 on 60981028c and seat REWORK 7186871392. Read this round: delta report 7190002779, git diff 60981028c..c1b30e6a0b (one commit, 10 files; no merge of main and no rebase, merge base still 5d21d431e), the whole diff origin/main...c1b30e6a0b (27 files, +1274/−12), the patched PR body, card #37487 with its comments, and the head's check-runs. main has moved to 54ea3c8c38; none of the files it changed since the merge base is in this PR. Nothing was built or run; every finding is a reading of the code, and none was reproduced.

① Derived judgments

Verdict in one line: no must-fix. S1, S2 and S3 are closed, S4 is carried on #37487, N2 and N3 are closed. The S2 fix opens one new should-fix (S5): the focus now re-runs when a navigation drops the history state.

Earlier findings.

S1 (should-fix) — CLOSED. sectionCandidates now puts the outline's count of same-reading headings on each candidate. locateSection takes drawn[ordinal] only when drawn.length === candidate.count, and opens the field for a candidate whose reading is empty. Both directions from the first round resolve to the field: a same-titled heading the outline does not list (setext, quoted, list, indented) makes the drawn count larger, and a listed heading the face does not draw makes it smaller. Pinned with controls in recordSectionAnchor.test.tsx (the same-titled unlisted heading, the listed undrawn heading for either anchor, the empty reading) and through the real view in RecordDetailView.citedSection-37365.test.tsx. The report's mutation (dropping the count check) turns three of them red. The PR body's A2 note no longer says "never". The residue is N6.

S2 (should-fix) — CLOSED, with S5 as its consequence. markSection returns an unmark that removes the attribute and only the classes it added; focusRecordSection's cleanup calls it, so a second anchor on the same record leaves one mark. The chat opener passes a fresh RECORD_SECTION_OPENED_STATE value on each chip click and RecordDetailView keys the effect on record, anchor and that value, so the same chip clicked again scrolls and marks again. Pinned in the helper test, the real-view test and AiChatPage.recordLink-13037.test.tsx. The key is history state, not a URL parameter (the RECORD_COMMENTS_PUSHED_STATE precedent), so Clause-② is unchanged and nothing joins RESERVED_URL_PARAMS.

S3 (should-fix) — CLOSED. The changeset title and body, plugin-chatbot.mdx and the chatbot README.md now say the console draws a verified citations part when a live answer carries one, that nothing in this release emits the part, and that a conversation reloaded from history does not redraw it yet. The changeset also states the new fallback (a different number of same-titled headings opens the field) and the moving mark.

S4 (should-fix) — CARRIED on #37487. Seat comment 7186889924 on that card adds the booted-console check to its acceptance: chips drawn, a chip click opening ?section=ANCHOR with the cited heading in view and marked from the dock and /ai, the chips redrawn after a reload, a refused part drawing nothing. The PR body's verification line points there. That acceptance lives in a comment, not the card body, and does not name the sticky chrome, the phone row or an html/richtext body; whoever takes #37487 should read the comment as part of the card.

N1 (nit) — OPEN, accepted by the seat as a deviation. Dot segments in object or id are still not refused; same-origin, same shape as open_record on main.
N2 (nit) — CLOSED. escapeAttr uses CSS.escape when present.
N3 (nit) — CLOSED. The candidates are in a useMemo on the record, the fields and the anchor.
N4 (nit) — OPEN, accepted. The chip shows the quote alone.
N5 (nit) — CLOSED. The PR body now lists the locale overlap with #37436.

New this round.

S5 (should-fix) — a navigation that drops the history state re-opens the cited section. citedSectionKey ends in the RECORD_SECTION_OPENED_STATE value, or '' when the entry carries none. RecordDetailView's own URL writes keep location.state, and the new CONTROL pins that case. Other writers on the same route do not: useUrlOverlay (setSearchParams(sp, { replace }), used by the command palette and the keyboard-shortcuts dialog), the record-form overlay in AppContent.tsx and RelatedRecordActionsBridge.tsx (setSearchParams(sp)). On a record opened from a chip, opening the palette or the edit form changes the key from the click's value to ''; the effect cleans up, unmarks and focuses again, so the page scrolls back to the cited heading behind the overlay. Closing the form with Back restores the entry that holds the value, and the page scrolls there once more. On the previous head the key was record and anchor only, so these writes moved nothing. Smallest fix: re-run only when a NEW string value arrives (hold the last value seen for this record and anchor, and ignore its absence), with a pin for a state-dropping replace and a push-then-back. No user reaches a chip before cloud 10c, so it need not block this head; close it here or name it on #37487.

N6 (nit) — the count check narrows S1's fault, it does not exclude it. A body with one same-titled heading the outline does not list AND one listed heading the face does not draw has equal counts and can still resolve to the other heading; so can a face that drew its headings one at a time. The markdown face draws in one commit, and the real-view pin holds. The PR body is worded correctly; the two test titles that say "never that heading" claim slightly more than the rule gives.

N7 (nit) — a heading with an empty reading opens the field only after the 4 s settle: attempt finishes at once for a text face but not for this case, though the answer is already known.

Unchanged from the first round, re-read on this head. Security is clean: recordOpenTarget is untouched, the new state value is a local counter string and never reaches a selector or markup, and the section value is still only compared with ===. Security-touching: no stands: no changed hunk changes or teaches permission, sharing, credential, token or authentication behaviour. section remains the one new reserved parameter, declared in urlParams.ts. The plugin-chatbot, plugin-detail and i18n sources are byte-identical to 60981028c, so the locale parity (11 of 11) and the overlap with #37436 stand as read.

Check-runs on the head: 66 completed, 54 success, 12 skipped, 0 failed, as the area reports.

② Semver level

patch on @object-ui/plugin-chatbot, @object-ui/app-shell, @object-ui/plugin-detail and @object-ui/i18n: still correct. Metadata-protocol: none takes patch, and a non-protocol widening ships patch. Clause-②: yes (a new reserved URL parameter section) stands at line start in the PR body and the changeset and the two agree. The delta adds no URL parameter and no public argument: RECORD_SECTION_OPENED_STATE is a history-state key, and markSection's new return value is internal to app-shell. No spec file changed.

③ Boundary flags

  • open_questions: empty.
  • security_findings: none: agreed.
  • Deviation, N2 and N3 taken beyond the order: accepted; both are small and both are closed above.
  • Deviation, the new history-state key: accepted as not a URL parameter; its side effect is S5.
  • Deviation, worktree recreated at 60981028c: no contract effect; the delta is one commit on that head.
  • Reading A2: the PR body now states the rule and its limit without "never" (N6).
  • Out-of-scope finding from round one, chips lost on reload: carried by 37365 跟进:刷新或重开对话后,AI 回答下方的引用消失 #37487, which now also carries the browser check (S4).
  • SQL push-down: not touched. The delta adds no data read, no id materialisation and no in-app join.

Implemented-by: claude/issue-37365-record-citation-chips
Reviewed-by: session_01Utp6CYtTDvfPQDzMbZnN5X

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

席位核对

Head-sha: c1b30e6a0b0c2548b331de1711581d9749459203
ACCEPT — L1, seat repo:objectstack#5

  1. Shape: open draft against main, Fixes #37365, Clause-②: no, four patch changesets. Not governed. 54 success · 12 expected skip · 0 failed. Mergeable clean.
  2. Premise: a record citation chip opens the cited section. The heading is taken only when the drawn count of same-reading headings matches the outline's count. Otherwise the field opens. The mark is removed by its own unmark, and each chip click is keyed by a fresh history-state value.
  3. Gates: delta record 7190126794 (same reviewer, verified on the transcript) reads PASS. S1, S2 and S3 are closed. N2, N3 and N5 are closed.
  4. Accepted deviations:
  5. Out of scope and where it went: 37365 跟进:刷新或重开对话后,AI 回答下方的引用消失 #37487.
  6. Landing terms: ungoverned, default tier. A same-head delta PASS plus this ACCEPT. Area ai-36996 lands it with --land and closes 记录 AI 问询 10b:控制台显示核对过的引用,点开记录并定位到被引章节 #37365.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

Landing: ACCEPT 7190174620 (delta contract record 7190126794, PASS) at head c1b30e6a0b0c2548b331de1711581d9749459203.

Probe Reading
Check-runs on head 54 success, 12 skipped, 0 failed, 0 in progress
Governed / size check-governed-merges --pr 37485: NOT governed, 1286 changed lines ≤ 3000; mergeable_state clean

Status: ready + auto-merge (merge queue). On MERGED, #37365 closes by Fixes; #37487 carries S4 (browser check) and S5 (section effect re-runs on state-dropping navigation), per scope note 7190147175.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/xl tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

记录 AI 问询 10b:控制台显示核对过的引用,点开记录并定位到被引章节

2 participants